/**
 * 
 */
package com.gsit.misn.common;

/**
 * @author udichee
 * 
 */
public enum MaritalStatus {

	MARRIED("Married"), 
	SINGLE("Single"),
	NAN("");

	private String code;

	private static MaritalStatus[] values = MaritalStatus.values();

	private MaritalStatus(String code) {
		this.code = code;
	}

	public String toCode() {
		return code;
	}

	public static MaritalStatus fromCode(String code) {
		for (MaritalStatus status : values) {
			if (status.code.equalsIgnoreCase(code))
				return status;
		}

		return NAN;
	}

	@Override
	public String toString() {
		return new StringBuilder(super.toString()).append(",code[")
				.append(code).append("]").toString();
	}

}
